package com.bw.zcb.mvp.model.entity;

import com.bw.zcb.mvp.base.model.BaseEntity;
import com.bw.zcb.utils.LogUtils;
import com.google.gson.Gson;


import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

public class ImageBannerEntity extends BaseEntity {
    public String values;

    public List<NewsEntity.Values> getValues(){
        if (values.isEmpty()){
            return null;
        }
            List<NewsEntity.Values> list = new ArrayList<>();
            try {
                JSONArray jsonArray = new JSONArray(values);
                for (int i = 0; i < jsonArray.length(); i++) {
                    String str = jsonArray.getString(i);
                    LogUtils.show("str"+str);
                    NewsEntity.Values entity = new Gson().fromJson(str,NewsEntity.Values.class);
                    list.add(entity);
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

        return list;
    }
}
